import React, { FC, useContext } from 'react';
import { View, Text, Image } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import { ProductCardContext } from '@/pages/components/ProductCard/ProductCardContext';
export interface IProps extends ICompProps {}
ProductPicture.defaultProps = {} as Partial<IProps>;
function ProductPicture(props: IProps) {
    const { className, style } = props;
    const localClassName = useClassName('ProductPicture', className);
    const { imgUrl } = useContext(ProductCardContext);
    return (
        <RootImage className={localClassName} style={style}>
            <Image className="img" src={imgUrl}></Image>
        </RootImage>
    );
}
export default React.memo(ProductPicture as FC<IProps>);
const RootImage = styled(View)`
    &.ProductPicture {
        width: 200px;
        height: 226px;
        border-radius: 16px;
        overflow: hidden;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.1);
        img {
            object-fit: contain;
        }
    }
`;
